//
//  ModifyEmailVC.m
//  LogisticsSupplier
//
//  Created by 吕晶 on 2020/8/31.
//  Copyright © 2020 吕晶. All rights reserved.
//

#import "ModifyEmailVC.h"
#import "InPutCodeVC.h"

@interface ModifyEmailVC ()

@property (nonatomic, strong) UITextField *textField;

@end

@implementation ModifyEmailVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = HexColor(0xffffff);
    [self configUI];
}

- (void)configUI {
    UILabel *titleLab = [[UILabel alloc] initWithFrame:CGRectMake(15, 30, ScreenW - 30, 21)];
    titleLab.font = BoldFontOfSize(20);
    titleLab.text = @"输入新的邮箱地址";
    titleLab.textColor = HexColor(0x2B2C44);
    [self.view addSubview:titleLab];
    
//    UILabel *remarkLab = [[UILabel alloc] initWithFrame:CGRectMake(15, 10 + titleLab.nim_bottom, ScreenW - 30, 15)];
//    remarkLab.font = [UIFont systemFontOfSize:14];
//    remarkLab.text = @"更换手机号后，下次可使用新手机号登录。";
//    remarkLab.textColor = HexColor(0x9C9DB3);
//    [self.view addSubview:remarkLab];
    
    UILabel *remark2Lab = [[UILabel alloc] initWithFrame:CGRectMake(15, 10 + titleLab.nim_bottom, ScreenW - 30, 15)];
    remark2Lab.font = [UIFont systemFontOfSize:14];
    remark2Lab.text = @"当前邮箱地址：";
    remark2Lab.textColor = HexColor(0x9C9DB3);
    [self.view addSubview:remark2Lab];
    [remark2Lab sizeToFit];
    
    UILabel *phoneLab = [[UILabel alloc] initWithFrame:CGRectMake(remark2Lab.nim_right, remark2Lab.nim_top, ScreenW - 15 - remark2Lab.nim_right, 15)];
    phoneLab.font = [UIFont systemFontOfSize:14];
    phoneLab.text = self.email;
    phoneLab.textColor = Color_ThemeColor;
    [self.view addSubview:phoneLab];
    [phoneLab sizeToFit];
    phoneLab.nim_centerY = remark2Lab.nim_centerY;
    
    UILabel *descLab = [[UILabel alloc] initWithFrame:CGRectMake(15, 30 + remark2Lab.nim_bottom, ScreenW - 30, 15)];
    descLab.font = [UIFont systemFontOfSize:14];
    descLab.text = @"新邮箱地址";
    descLab.textColor = HexColor(0x2B2C44);
    [self.view addSubview:descLab];
    
    self.textField = [[UITextField alloc] initWithFrame:CGRectMake(titleLab.nim_left, descLab.nim_bottom + 5, descLab.nim_width, 40)];
    self.textField.placeholder = @"请输入";
    self.textField.textColor = HexColor(0x2B2C44);
    self.textField.font = [UIFont systemFontOfSize:16];
    self.textField.clearButtonMode = UITextFieldViewModeWhileEditing;
    [self.view addSubview:self.textField];
    
    UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake(self.textField.nim_left, self.textField.nim_bottom, self.textField.nim_width, 1)];
    line.backgroundColor = HexColor(0xF2F2F5);
    [self.view addSubview:line];
    
    UIButton *nextBtn = [[UIButton alloc] initWithFrame:CGRectMake(30, line.nim_bottom + 30, ScreenW - 60, 44)];
    nextBtn.backgroundColor = Color_ThemeColor;
    nextBtn.layer.cornerRadius = 6;
    [nextBtn setTitle:@"下一步" forState:0];
    [nextBtn setTitleColor:HexColor(0xffffff) forState:0];
    nextBtn.titleLabel.font = BoldFontOfSize(16);
    [nextBtn addTarget:self action:@selector(nextClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:nextBtn];
}

- (void)nextClick {
//    if ([FactoryMethod isNull:self.textField.text]) {
//        [MBProgressHUD leShowFailedHUD:self.view message:@"请输入手机号"];
//        return;
//    }
//    if (![FactoryMethod isPhone:self.textField.text]) {
//        [MBProgressHUD leShowFailedHUD:self.view message:@"请输入正确的手机号"];
//        return;
//    }
    InPutCodeVC *vc = [InPutCodeVC new];
    vc.phone = self.textField.text;
    vc.isEmail = YES;
    [self.rt_navigationController pushViewController:vc animated:YES];
}

@end
